#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:Vergil
# datetime:2018/11/2 14:49
import socket

def get_host_ip():
    try:
        global s
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('8.8.8.8', 80))
        ip = s.getsockname()[0]
    finally:
        s.close()

    return ip
